// JavaScript Document

// scrollable
if($("#home").length>0)$("div.scrollable").scrollable({circular: true}).autoscroll({interval: 6000, autopause: false});

// fade
$("img").css("visibility", "hidden").imagesLoaded({
	progress: function(isBroken, $images, $proper, $broken) {
		var $this = $(this).css("visibility", "");
		if($.support.opacity) $this.css("opacity", 0).animate({"opacity": 1}, function() { $this.css({"opacity": ""}); if(!$this.attr("style")) $this.removeAttr("style"); });
	}
});

// link
$("#section").on({
	mouseenter: function() {
		$(this).find("img").css({"visibility": "visible", "opacity": 0}).stop(true).animate({"opacity": 1});
	},
	mouseleave: function() {
		$(this).find("img").stop(true).animate({"opacity": 0}, "medium", function() { $(this).attr("style", ""); });
	}
}, "div.link");



// miembros
//$("div.scrollable.alt").scrollable({circular: true, prev: ".prev_alt", next: ".next_alt"});
$("div.scrollable.alt").scrollable({circular: false});
$("div.detail").eq(0).show();
$("div.subitem").on("click", function() {
	var $this = $(this),
		index = $this.index() + (7 * ($this.parent().index("div.item:not(.cloned)")));
	if($this.hasClass("current")) return;
	$("div.subitem").removeClass("current");
	$this.addClass("current");
	$("div.detail").hide().eq(index).fadeIn();
});